package dsdalcatraz.server;
import dsdalcatraz.server.ServerInterfaceImpl;

import java.rmi.Naming;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;

import spread.*;


public class ServerMain  {
	public static String rmihost;
	
	public static void main(String[] arguments) {
		rmihost = arguments[0].toString();
		//load rmireg, spread
				rmireg();
				conreg();		
	}
	
	
	public static void rmireg() {
			LocateRegistry.createRegistry(1099);
			System.out.println("RMI Registry erstellt");
	}
		
	public static void conreg() {
		ServerInterfaceImpl gamereg = new ServerInterfaceImpl();
			Naming.rebind("rmi://"+rmihost+":1099/ServerRegistration", gamereg);
			System.out.println("Verbunden zur RMI Registry @ " + rmihost);
			//System.out.println("Verbunden zur RMI Registry @ " + InetAddress.getLocalHost().getHostAddress());
	} 
}

